//
//  AXFAdviceFeedbackController.m
//  客服和反馈
//
//  Created by Freakthen on 2016/11/21.
//  Copyright © 2016年 Freakthen. All rights reserved.
//

#import "AXFAdviceFeedbackController.h"
#import "CZAdditions.h"
#import "Masonry.h"
#import "AXFSecondView.h"
@interface AXFAdviceFeedbackController ()

@end

@implementation AXFAdviceFeedbackController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}


- (void)setupUI
{
	self.view.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
	self.navigationController.navigationBar.translucent = NO;
	
	UIView *bgView = [[UIView alloc] init];
    UILabel *label = [[UILabel alloc] init];
 
	NSArray <NSString *> *titleArray = @[@"商品种类",@"商品品质",@"软件功能"];
	NSArray <NSString *> *titleArray1 = @[@"促销活动",@"配送服务",@"其他问题"];
	
	label.text = @"*请先选择问题类型";
	label.font = [UIFont systemFontOfSize:10];
	
	bgView.backgroundColor = [UIColor whiteColor];
	
	[self.view addSubview:bgView];
	[self.view addSubview:label];
	
	NSArray<UIButton *> *array = [self setupButtonArrayWithButtonNameArray:titleArray];
	NSArray<UIButton *> *array1 = [self setupButtonArrayWithButtonNameArray:titleArray1];
	
	[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.top.equalTo(self.view).offset(20);
		make.height.mas_equalTo(200);
		make.width.mas_equalTo(self.view.frame.size.width);
	}];
	
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.top.equalTo(bgView.mas_top).offset(5);
    }];

    [array mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:20 leadSpacing:20 tailSpacing:20];
    [array mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label).offset(20);
    }];
    
    [array1 mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:20 leadSpacing:20 tailSpacing:20];
    [array1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(array[0].mas_bottom).offset(50);
    }];
    
    AXFSecondView *view = [AXFSecondView secondView];
    view.frame =  CGRectMake(0, 250, self.view.bounds.size.width, 300);
    [self.view addSubview:view];
    
    UIButton *buton = [[UIButton alloc] init];
    buton.backgroundColor = [UIColor cz_colorWithHex:0xffd600];
    [buton setTitle:@"确定提交" forState:UIControlStateNormal];
    [buton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.view addSubview:buton];
    
    [buton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.view).offset(15);
        make.right.equalTo(self.view).offset(-15);
        
        make.top.equalTo(view.mas_bottom).offset(31);
        make.height.mas_equalTo(40);
    }];
}

- (NSArray <UIButton *> *)setupButtonArrayWithButtonNameArray:(NSArray*)array
{
    NSMutableArray <UIButton *>*buttonArray = [NSMutableArray array];
    [array enumerateObjectsUsingBlock:^(NSString * _Nonnull title, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *button = [UIButton cz_textButton:title fontSize:12 normalColor:[UIColor blackColor] selectedColor:[UIColor grayColor]];
	
        button.layer.borderColor = [UIColor blackColor].CGColor;
        button.layer.borderWidth= 1;
        button.layer.cornerRadius = 5;
        [button.layer setMasksToBounds:YES];
		
		[buttonArray addObject:button];
        
        [self.view addSubview:button];
    }];
    return buttonArray;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
